import request from '@/api/request';
import { apiClusterJava } from '@/api/root';

/*------------------------------------------------ 企业端 - 个人中心 ----------------------------------*/
// 视频播放量统计
export const uploadVideoPlayCount = (data) => {
  return request.webserviceOld(
    'job1001',
    'comm_article_busi/addShortVideoTrackingData',
    data,
    {
      version: 'v7.8.6'
    }
  );
};

/*------------------------------------------------ 企业端 - 创建招聘名片 ----------------------------------*/

// 根据企业名称获取企业列表
export const getCompanyList = (data) => {
  return request.webservice(
    'mp',
    `${apiClusterJava}/api-yp/open/index`,
    '/homeOpen/getCompanyListByCname',
    data
  );
};

// 创建招聘名片
export const createBusinessCard = (data) => {
  return request.webservice(
    'mp',
    `${apiClusterJava}/api-yp/open/index`,
    '/homeOpen/createBusinessCard',
    data
  );
};

// 是否公司员工（绑定流程）
export const isCompanyStaff = (data) => {
  return request.webserviceOld(
    'company',
    'bingding_companyperson_slave/isCompanyStaff',
    data
  );
};

// 提交企业和个人认证
export const addAudit = (data) => {
  return request.webserviceOld(
    'job1001',
    'person_enterprise_audit/add_audit',
    data
  );
};

// 企业是否已经下载简历或人才是否已经投递简历
export const checkHadDownOrDelivery = (data) => {
  return request.webserviceOld(
    'company',
    'person_resume_slave/checkResumeDownOrDelivery',
    data
  );
};

// 认证状态信息
export const getFailInfo = (data) => {
  return request.webserviceOld(
    'job1001',
    'person_enterprise_audit/getFailInfo',
    data
  );
};

// 校验企业个人审核数据
export const checkPersonAudit = (data) => {
  return request.webservice(
    'mp',
    `${apiClusterJava}/api-yp/open/index`,
    '/rightOpen/checkPersonAudit',
    data
  );
};

// 企业面试通知列表
export const getCInterviewList = (data) => {
  return request.webserviceOld(
    'job1001',
    'person_info_busi/getCInterviewList',
    data,
    {
      version: 'v7.2.8'
    }
  );
};

// 获取企业后台我模块红点是否显示
export const getMineNews = (data) => {
  return request.webserviceOld(
    'job1001',
    'company_info_busi/getMineNews',
    data,
    {
      version: 'v7.7.0'
    }
  );
};

// 放弃认证
export const cancelAuth = (data) => {
  return request.webservice(
    'mp',
    `${apiClusterJava}/api-yp/open/index`,
    '/homeOpen/cancelAuth',
    data
  );
};

/*------------------------------------------------ 企业端 - 权益 ----------------------------------*/

// 获取个人权益包详情
export const getCompanyPersonAllRights = (data) => {
  return request.webservice(
    'mp',
    `${apiClusterJava}/api-yp/open/index`,
    '/rightOpen/getCompanyPersonAll',
    data
  );
};

// 获取个人单个权益详情
export const getCompanyPersonOne = (data) => {
  return request.webservice(
    'mp',
    `${apiClusterJava}/api-yp/open/index`,
    '/rightOpen/getCompanyPersonOne',
    data
  );
};

//职位发布、置顶使用记录
export const getJobLog = (data) => {
  return request.webservice(
    'mp',
    `${apiClusterJava}/api-yp/open/index`,
    '/rightOpen/getJobLog',
    data
  );
};

// // 职位置顶卡使用记录
// export const getTopLog = (data) => {
//   return request.webservice('mp', `${apiClusterJava}/api-yp/open/index`, '/rightOpen/getToppingLog', data);
// };

// 生成订单&支付聚合接口
export const addOrderAndPay = (data) => {
  return request.webservice(
    'mp',
    `${apiClusterJava}/api-yp/open/index`,
    '/orderOpen/addOrderAndPay',
    data
  );
};

// 权益校验接口
export const checkCompanyPersonRight = (data) => {
  return request.webservice(
    'mp',
    `${apiClusterJava}/api-yp/open/index`,
    '/rightOpen/checkCompanyPersonRight',
    data
  );
};

// 道具购买记录
export const getOrderList = (data) => {
  return request.webservice(
    'mp',
    `${apiClusterJava}/api-yp/open/index`,
    '/orderOpen/getOrderList',
    data
  );
};

// 是否已查看简历
export const isCheckedResume = (data) => {
  return request.webserviceOld(
    'company',
    'person_resume_slave/isCheckedResume',
    data
  );
};

// 权益消耗
export const doCompanyPersonRightsConsume = (data) => {
  return request.webservice(
    'mp',
    `${apiClusterJava}/api-yp/open/index`,
    '/rightOpen/doCompanyPersonRightsConsume',
    data
  );
};

// 提交发票申请（可批量）
export const addInvoice = (data) => {
  return request.webservice(
    'mp',
    `${apiClusterJava}/api-yp/open/index`,
    '/orderOpen/addInvoice',
    data
  );
};

// 发票详情
export const getInvoiceById = (data) => {
  return request.webservice(
    'mp',
    `${apiClusterJava}/api-yp/open/index`,
    '/orderOpen/getInvoiceById',
    data
  );
};

// 发票信息变更
export const updateInvoice = (data) => {
  return request.webservice(
    'mp',
    `${apiClusterJava}/api-yp/open/index`,
    '/orderOpen/updateInvoice',
    data
  );
};

/*------------------------------------------------ 企业端 - 简历 ----------------------------------*/

// 更新简历已读
export const updateCmailboxNew = (data) => {
  return request.webserviceOld('job1001', 'cmailbox/updateCmailboxNew', data);
};

// 获取简历联系方式（下载简历）
export const jianliDownloadNew = (data) => {
  return request.webserviceOld(
    'job1001',
    'bingding_companyperson_slave_busi/jianliDownloadNew',
    data,
    {
      version: 'v7.8.0'
    }
  );
};

// 获取人才绑定企业状态
export const getPersonBindCompanyStatus = (data) => {
  return request.webservice(
    'mp',
    `${apiClusterJava}/api-yp/open/index`,
    '/rightOpen/getPersonBindCompanyStatus',
    data
  );
};

// 我的权益报告
export const getPersonReport = (data) => {
  return request.webservice(
    'mp',
    `${apiClusterJava}/api-yp/open/index`,
    '/activityOpen/personReport',
    data
  );
};

// 我的权益案例
export const getPersonCase = (data) => {
  return request.webservice(
    'mp',
    `${apiClusterJava}/api-yp/open/index`,
    '/activityOpen/personCase',
    data
  );
};

// 根据企业名称获取企业
export const getCompanyNameByName = (data) => {
  return request.webservice(
    'mp',
    `${apiClusterJava}/api-yp/open/index`,
    '/companyOpen/getCompanyNameByName',
    data
  );
};

// 获取行业分类
export const trade = (data) => {
  return request.webservice(
    'mp',
    `${apiClusterJava}/api-yp/open/index`,
    '/jobOpen/trade',
    data
  );
};

// 人才库搜索简历（搜索简历搜索记录）（v2.15）
export const getHistoryKwList = (data) => {
  return request.webservice(
    'mp',
    `${apiClusterJava}/api-yp/open/index`,
    '/companyOpen/latelySearchLogs',
    data
  );
};

// 人才库搜索简历（搜索简历）（v2.15）
export const getSearchResume = (data) => {
  return request.webservice(
    'mp',
    `${apiClusterJava}/api-yp/open/index`,
    '/companyOpen/personSearch',
    data
  );
};

// 人才库搜索简历（删除搜索简历搜索记录）（v2.15）
export const deleteHistoryKwList = (data) => {
  return request.webservice(
    'mp',
    `${apiClusterJava}/api-yp/open/index`,
    '/companyOpen/clearSearchLog',
    data
  );
};

// 加入企业（手机验证码加入企业获取企业基本信息）（v2.16）
export const getJoinCompanyInfo = (data) => {
  return request.webservice(
    'mp',
    `${apiClusterJava}/api-yp/open/index`,
    '/rightOpen/getCompanyMainContact',
    data
  );
};

// 加入企业（手机验证码加入企业获取验证码）（v2.16）
export const getJoinCompanyMsCode = (data) => {
  return request.webservice(
    'mp',
    `${apiClusterJava}/api-yp/open/index`,
    '/rightOpen/sendConfirmCode',
    data
  );
};

// 加入企业（手机验证码加入企业确定加入）（v2.16）
export const confirmJoinCompany = (data) => {
  return request.webservice(
    'mp',
    `${apiClusterJava}/api-yp/open/index`,
    '/rightOpen/confirmByCode',
    data
  );
};

/*------------------------------------------------ AI面评 ----------------------------------*/

// 职途 - 获取真题列表
export const getQuestList = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/ztInterview/getInferviewInfoPage',
    data
  );
};

// 企业招聘面试列表查询
export const refAddPoint = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/interview/addPoint',
    data
  );
};

// 企业招聘面试列表查询
export const getCompanyInterviewData = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/aiiCompanyInterview/interviewList',
    data
  );
};

// 企业招聘面试基本信息查询
export const getCompanyInterviewInfo = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/aiiCompanyInterview/interviewInfo',
    data
  );
};

// 企业删除招聘面试
export const getCompanyInterviewDel = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/aiiCompanyInterview/deleteInterview',
    data
  );
};

// 企业查询面试题目
export const getCompanyInterviewIssues = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/aiiCompanyInterview/queryQuestionsById',
    data
  );
};
// 题库详情查询
export const repoInfo = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/aiiCompanyInterviewRepo/repoInfo',
    data
  );
};
// 题目列表分页查询
export const questionListByPage = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/aiiCompanyInterviewRepoQuest/questionListByPage',
    data
  );
};

// 题目详情
export const questionInfo = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/aiiCompanyInterviewRepoQuest/questionInfo',
    data
  );
};

// 编辑题目
export const updateQuestion = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/aiiCompanyInterviewRepoQuest/updateQuestion',
    data
  );
};

// 从公共库批量复制题目
export const batchCopyQuestionFromCommon = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/aiiCompanyInterviewRepoQuest/batchCopyQuestionFromCommon',
    data
  );
};
// 批量选择题目保存到题库
export const batchCopyQuestion = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/aiiCompanyInterviewRepoQuest/batchCopyQuestion',
    data
  );
};
// 题目排序
export const questionSort = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/aiiCompanyInterviewRepoQuest/questionSort',
    data
  );
};
// 新增题目
export const createQuestion = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/aiiCompanyInterviewRepoQuest/createQuestion',
    data
  );
};
// 删除题目
export const removeQuestion = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/aiiCompanyInterviewRepoQuest/removeQuestion',
    data
  );
};

// 企业查询面试题目
export const getCompanyInterviewIssuesDB = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/aiiCompanyInterview/queryPositionQuestion',
    data
  );
};

// 企业历史选题列表查询
export const getCompanyInterviewHistory = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/aiiCompanyInterview/queryHistoryInterview',
    data
  );
};

// 企业创建招聘面试
export const getCompanyInterviewCreate = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/aiiCompanyInterview/createInterview',
    data
  );
};

// 企业职业搜索
export const getCompanyInterviewSearch = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/aiiCompanyInterview/queryYlPosition',
    data
  );
};

// 面试结果列表
export const getCompanyInterviewResultList = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/aiiIntervieweeInterview/interviewResultList',
    data
  );
};

// 面试结果
export const getCompanyInterviewResul = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/aiiIntervieweeInterview/queryInterviewResultDetail',
    data
  );
};

// 面试历史试题
export const getCompanyHistoryInterview = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/aiiCompanyInterview/queryHistoryInterview',
    data
  );
};

// 新增题库
export const createCompanyRepo = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/aiiCompanyInterviewRepo/createRepo',
    data
  );
};

// 删除题库
export const deleteCompanyRepo = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/aiiCompanyInterviewRepo/removeRepo',
    data
  );
};

// 查询题库列表(分页)
export const getCompanyRepo = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/aiiCompanyInterviewRepo/repoListByPage',
    data
  );
};

// 根据职业id筛选题库列表(不分页)
export const getCompanyRepoList = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/aiiCompanyInterviewRepo/repoList',
    data
  );
};

export const getCompanyRepoIds = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/aiiCompanyInterviewRepoQuest/querySelectedQuestion',
    data
  );
};

// 开始面试
export const beginInterview = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/aiiIntervieweeInterview/beginInterviewByApplet',
    data
  );
};
// 面试信息(职途)
export const reqZhituGetInfo = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/ztInterview/getInterviewInfo',
    data
  );
};
// 开始面试数据(职途)
export const reqZhituGetBeginData = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/ztInterview/beginInterview',
    data
  );
};
// 上报开始面试(职途)
export const reqZhituReportBegin = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/ztInterview/startAnswerQuestion',
    data
  );
};
// 上报结束面试(职途)
export const reqZhituReportEnd = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/ztInterview/endAnswerQuestion',
    data
  );
};
// 查询面试结果列表(职途)
export const reqZhituGetRecord = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/ztInterview/getInterviewRecord',
    data
  );
};
// 查询面试结果列表(职途)
export const reqZphGetRights = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/interviewRights/getRights',
    data
  );
};

// 查询职业列表
export const reqZhituGetCareer = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/ztInterview/getMatchCareer',
    data
  );
};

//扎堆职业列表
export const reqZhaduiGetCareer = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/ztInterview/getDemonstratePosition',
    data
  );
};

// 查询当前用户是否已经完成本场面试
export const reqZhituHasFinished = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/ztInterview/checkBeforeInterview',
    data
  );
};
// 查询面试结果
export const reqZhituGetResult = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/ztInterview/getRecordResultById',
    data
  );
};

// 根据求职意向配置职业
export const reqRecommendPosition = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/ztInterview/getRecommendPosition',
    data
  );
};

export const unlockInterviewResult = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/ztInterview/unlock',
    data
  );
};
// 题目点赞
export const reqlikeQuestion = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/ztQuestion/likeQuestion',
    data
  );
};
// 题目列表
export const reqQuestionList = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/ztQuestion/getQuestionList',
    data
  );
};

// 专职题库列表
export const reqPositionQuestionInfo = (data) => {
  return request.webservice(
    'aj',
    `${apiClusterJava}/api-statistics/open/index`,
    '/ztQuestion/getPositionQuestionInfo',
    data
  );
};

// 企业招聘面试题目
export const getAIInterviewQuestions = (data) => {
  return request.post(
    `${apiClusterJava}/api-statistics/aii/company/interview/queryQuestionsById`,
    data
  );
};

// 面试端 - 面试信息
export const getAIInterviewInfo = (data) => {
  return request.post(
    `${apiClusterJava}/api-statistics/aii/company/interview/interviewInfo`,
    data
  );
};

export const getInterviewDetail = (data) => {
  return request.post(
    `${apiClusterJava}/api-statistics/aii/interviewee/interview/queryInterviewInfoDetail`,
    data
  );
};

// 题目开始回答
export const startQuestionAnswer = (data) => {
  return request.post(
    `${apiClusterJava}/api-statistics/aii/interviewee/interview/startQuestionAnswer`,
    data
  );
};
// 题目结束回答
export const endQuestionAnswer = (data) => {
  return request.post(
    `${apiClusterJava}/api-statistics/aii/interviewee/interview/endQuestionAnswer`,
    data
  );
};
/*------------------------------------------------  ----------------------------------*/

// 用personId获取集团子账号列表
export const getGroupAccountList = (data) => {
  return request.webservice(
    'mp',
    `${apiClusterJava}/api-yp/open/index`,
    '/companyOpen/getGroupAccountList',
    data
  );
};

// 企业专属顾问
export const getCustomerService = (data) => {
  return request.post(
    `${apiClusterJava}/api-yp/common/home/getCustomerService`
  );
};
